<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/admincontent.jsp" %>
<link rel="stylesheet" href="/resources/js/plugins/kindeditor-4.1.10/themes/default/default.css"/>
<div id="location">当前位置：首页 > 内容管理 > 文章管理 > 添加文章</div>
<div id="Content">
    <form id="Validform" method="post" action="/CMS/AddAction">
        <%--  <div class="btnbar">
            <%--
              <button type="submit" class="save layui-btn layui-btn-sm layui-btn-normal">
                  <i class="layui-icon">&#xe608;</i> 保存文章
              </button>
              <button type="button" class="back" onclick="javascript:history.go(-1);">返回</button>
          </div> --%>
<%--        <div class="toullbars">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-radius"><i class="ico16 save_as_16"></i>保存文章</button>
            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" onclick="javascript:history.go(-1);"><i class="ico16 return_16"></i>返回</button>
        </div>--%>
            <div class="toolbars">
                <a id="add" onclick="addword()">
                    <em id="add_em" class="ico16 save_traft_16"></em>
                    <span id="send_span" class="menu_span" title="保存文章">保存文章</span>
                </a>
                <a onclick="self.location = document.referrer;">
                    <em  class="ico16 cancle_publish_16"></em>
                    <span  class="menu_span" title="返回">返回</span>
                </a>
            </div>
        <table class="conttable">
            <tbody>
            <tr>
                <td width="80" style="text-align:center;">所属栏目:</td>
                <td style="padding:10px 5px;">
                    <div><select name="nodeid" id="nodeid" datatype="*" nullmsg="所属栏目不能为空">${nodes}</select></div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">文章标题:</td>
                <td style="padding:10px 5px;">
                    <div><input type="text" name="title" id="title" datatype="*" nullmsg="文章标题不能为空"/></div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">文章内容:</td>
                <td style="padding:10px 5px;">
                    <div class="htmleditor">
                        <textarea id="myEditor" name="conts" datatype="*" nullmsg="文章内容不能为空！"
                                  style="width:100%;height:260px;"></textarea>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">添加时间:</td>
                <td style="padding:10px 5px;">
                    <div><input type="text" name="addtime" id="addtime" class="select" datatype="*" nullmsg="添加时间不能为空"
                                onFocus="blur()" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'})"/></div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">招聘方式:</td>
                <td style="padding:10px 5px;">
                    <div>
                        <select name="cmstype" id="cmstype">
                            <option value="高校校园招聘">高校校园招聘</option>
                            <option value="中专校园招聘">中专校园招聘</option>
                            <option value="社会招聘">社会招聘</option>
                            <option value="内部招聘">内部招聘</option>
                        </select>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">是否下线:</td>
                <td style="padding:10px 5px;">
                    <div>
                        <select name="isdis" id="isdis">
                        <option value="已保存">已保存</option>
                        <option value="已下线">已下线</option>
                        </select>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
<%--
<script charset="utf-8" src="/resources/js/plugins/kindeditor-4.1.10/kindeditor-min.js"></script>
<script charset="utf-8" src="/resources/js/plugins/kindeditor-4.1.10/lang/zh_CN.js"></script>--%>
<link rel="stylesheet" href="<%=basepath%>/resources/css/skin.css" />
<link type="text/css" rel="Stylesheet" href="/resources/js/plugins/WordPaster/css/WordPaster.css"/>
<link type="text/css" rel="Stylesheet" href="/resources/js/plugins/WordPaster/js/skygqbox.css" />
<script type="text/javascript" charset="utf-8" src="/resources/js/plugins/WordPaster/kindeditor-min.js"></script>
<script type="text/javascript" charset="utf-8" src="/resources/js/plugins/WordPaster/lang/zh_CN.js"></script>
<script type="text/javascript" src="/resources/js/plugins/WordPaster/js/json2.min.js" charset="utf-8"></script>
<script type="text/javascript" src="/resources/js/plugins/WordPaster/js/jquery-1.4.min.js" charset="utf-8"></script>
<script type="text/javascript" src="/resources/js/plugins/WordPaster/js/skygqbox.js" charset="utf-8"></script>
<script type="text/javascript" src="/resources/js/plugins/WordPaster/js/w.edge.js" charset="utf-8"></script>
<script type="text/javascript" src="/resources/js/plugins/WordPaster/js/w.app.js" charset="utf-8"></script>
<script type="text/javascript" src="/resources/js/plugins/WordPaster/js/w.file.js" charset="utf-8"></script>
<script type="text/javascript" src="/resources/js/plugins/WordPaster/js/w.js" charset="utf-8"></script>

<link type="text/css" rel="stylesheet" href="/resources/js/plugins/WordPaster/themes/simple/simple.css" />
<script type="text/javascript">
    function addword(){
        var nodeid = $("#nodeid").val();
        var title = $("#title").val();
       /* var conts = $("#myEditor").val();*/
        var conts = $("textarea[name='conts']").val()
        var addtime = $("#addtime").val();
        var cmstype = $("#cmstype").val();
        var isdis = $("#isdis").val();

        $.ajax({
            url: "/CMS/AddAction",
            type: 'POST',
            data: {
                "nodeid": nodeid,
                "title": title,
                "conts": conts,
                "addtime": addtime,
                "cmstype": cmstype,
                "isdis": isdis
            },
            success: function (data) {
                layer.msg(data.Message, {icon: 1});
                self.location = document.referrer;
            },
            error: function (data) {
                layer.msg(data.Message, {icon: 2});
            }
        });
    }
  /*  $(function () {
        $("#add").on('click',function () {
            var nodeid = $("#nodeid").val();
            var title = $("#title").val();
            var conts = $("#myEditor").val();
            var addtime = $("#addtime").val();
            var cmstype = $("#cmstype").val();
            var isdis = $("#isdis").val();

            $.ajax({
                url: "/CMS/AddAction",
                type: 'POST',
                data: {
                    "nodeid": nodeid,
                    "title": title,
                    "conts": conts,
                    "addtime": addtime,
                    "cmstype": cmstype,
                    "isdis": isdis
                },
                success: function (data) {
                    layer.msg(data.Message, {icon: 1});
                    self.location = document.referrer;
                },
                error: function (data) {
                    layer.msg(data.Message, {icon: 2});
                }
            });
        });
    });*/

    var pasterMgr = new WordPasterManager();
    pasterMgr.Config["PostUrl"] = "<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()%>/CMS/uploadpic";
    pasterMgr.Config["Cookie"] = 'JSESSIONID=<%=request.getSession().getId()%>';
    pasterMgr.Load();//

    //实例化编辑器
    var editor;
    KindEditor.ready(function (K) {
       editor =  K.create('#myEditor', {
           /* resizeType: 1,*/
            items: [
                'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste',
                'plainpaste', 'wordpaste', 'wordpaster', '|', 'justifyleft', 'justifycenter', 'justifyright',
                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
                'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
                'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'code', 'pagebreak',
                'link', 'unlink', '|', 'about'],
           afterCreate:function(){
                pasterMgr.SetEditor(this);
                var self = this;
                KindEditor.ctrl(self.edit.doc,'V',function(){pasterMgr.Paste();});
           },
            afterBlur: function () {
                this.sync();
            }
        });
    });
</script>

</body>
</html>